package cn.pengyinrui.department.system.user.service.impl;

import cn.pengyinrui.department.system.emp.domain.Employee;
import cn.pengyinrui.department.system.register.domain.Register;
import cn.pengyinrui.department.system.user.domain.User;
import cn.pengyinrui.department.system.user.service.IUserService;
import cn.pengyinrui.department.base.service.impl.BaseServiceImpl;
import cn.pengyinrui.department.system.user.mapper.UserMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author peng.yr
 * @since 2023-01-30
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<User> implements IUserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public User findOneByPhone(String phone) {
        return userMapper.findOneByPhone(phone);
    }

    @Override
    public User findOneByEmail(String email) {
        return userMapper.findOneByEmail(email);
    }

    @Override
    public void addByEmail(Register register) {
        User user = new User();
        BeanUtils.copyProperties(register,user);
        userMapper.add(user);
    }
}
